package com.tang.sharding.schedule.task.jdbc;

import com.tang.sharding.ShardProperties;
import com.tang.sharding.enums.Epoch;
import com.tang.sharding.enums.ShardingCycle;

/**
 * @author Tang
 * @classname CreateTableRunnableTask
 * @description [  ]
 * @date 2021/8/1 17:08
 */
public class CreateTableRunnableTask extends AbstractJdbcRunnableTask {

    public CreateTableRunnableTask(String taskId, JdbcManager jdbcManager,
                                   ShardProperties.TableRule tableRule) {
        super(taskId, jdbcManager, tableRule);
    }

    @Override
    protected String getTableName(String logicTable) {
        ShardingCycle shardingCycle = tableRule.getShardingCycle();
        return this.jdbcManager.getNewTableName(logicTable, shardingCycle, Epoch.next);
    }
}